using System;
using System.Drawing;
using PickGold.Charting;

namespace PickGold.Charting.Utilities
{
	internal static class ChartPaletteColors
	{
		private static Color[] _colorsBerry = new Color[] { Color.BlueViolet, Color.MediumOrchid, Color.RoyalBlue, Color.MediumVioletRed, Color.Blue, Color.BlueViolet, Color.Orchid, Color.MediumSlateBlue, Color.FromArgb(0xc0, 0, 0xc0), Color.MediumBlue, Color.Purple };
		private static Color[] _colorsBrightPastel = new Color[] { Color.FromArgb(0x41, 140, 240), Color.FromArgb(0xfc, 180, 0x41), Color.FromArgb(0xe0, 0x40, 10), Color.FromArgb(5, 100, 0x92), Color.FromArgb(0xbf, 0xbf, 0xbf), Color.FromArgb(0x1a, 0x3b, 0x69), Color.FromArgb(0xff, 0xe3, 130), Color.FromArgb(0x12, 0x9c, 0xdd), Color.FromArgb(0xca, 0x6b, 0x4b), Color.FromArgb(0, 0x5c, 0xdb), Color.FromArgb(0xf3, 210, 0x88), Color.FromArgb(80, 0x63, 0x81), Color.FromArgb(0xf1, 0xb9, 0xa8), Color.FromArgb(0xe0, 0x83, 10), Color.FromArgb(120, 0x93, 190) };
		private static Color[] _colorsChocolate = new Color[] { Color.Sienna, Color.Chocolate, Color.DarkRed, Color.Peru, Color.Brown, Color.SandyBrown, Color.SaddleBrown, Color.FromArgb(0xc0, 0x40, 0), Color.Firebrick, Color.FromArgb(0xb6, 0x5c, 0x3a) };
		private static Color[] _colorsDefault = new Color[] { Color.Green, Color.Blue, Color.Purple, Color.Lime, Color.Fuchsia, Color.Teal, Color.Yellow, Color.Gray, Color.Aqua, Color.Navy, Color.Maroon, Color.Red, Color.Olive, Color.Silver, Color.Tomato, Color.Moccasin };
		private static Color[] _colorsEarth = new Color[] { Color.FromArgb(0xff, 0x80, 0), Color.DarkGoldenrod, Color.FromArgb(0xc0, 0x40, 0), Color.OliveDrab, Color.Peru, Color.FromArgb(0xc0, 0xc0, 0), Color.ForestGreen, Color.Chocolate, Color.Olive, Color.LightSeaGreen, Color.SandyBrown, Color.FromArgb(0, 0xc0, 0), Color.DarkSeaGreen, Color.Firebrick, Color.SaddleBrown, Color.FromArgb(0xc0, 0, 0) };
		private static Color[] _colorsExcel = new Color[] { Color.FromArgb(0x99, 0x99, 0xff), Color.FromArgb(0x99, 0x33, 0x66), Color.FromArgb(0xff, 0xff, 0xcc), Color.FromArgb(0xcc, 0xff, 0xff), Color.FromArgb(0x66, 0, 0x66), Color.FromArgb(0xff, 0x80, 0x80), Color.FromArgb(0, 0x66, 0xcc), Color.FromArgb(0xcc, 0xcc, 0xff), Color.FromArgb(0, 0, 0x80), Color.FromArgb(0xff, 0, 0xff), Color.FromArgb(0xff, 0xff, 0), Color.FromArgb(0, 0xff, 0xff), Color.FromArgb(0x80, 0, 0x80), Color.FromArgb(0x80, 0, 0), Color.FromArgb(0, 0x80, 0x80), Color.FromArgb(0, 0, 0xff) };
		private static Color[] _colorsFire = new Color[] { Color.Gold, Color.Red, Color.DeepPink, Color.Crimson, Color.DarkOrange, Color.Magenta, Color.Yellow, Color.OrangeRed, Color.MediumVioletRed, Color.FromArgb(0xdd, 0xe2, 0x21) };
		private static Color[] _colorsGrayScale = InitializeGrayScaleColors();
		private static Color[] _colorsLight = new Color[] { Color.Lavender, Color.LavenderBlush, Color.PeachPuff, Color.LemonChiffon, Color.MistyRose, Color.Honeydew, Color.AliceBlue, Color.WhiteSmoke, Color.AntiqueWhite, Color.LightCyan };
		private static Color[] _colorsPastel = new Color[] { Color.SkyBlue, Color.LimeGreen, Color.MediumOrchid, Color.LightCoral, Color.SteelBlue, Color.YellowGreen, Color.Turquoise, Color.HotPink, Color.Khaki, Color.Tan, Color.DarkSeaGreen, Color.CornflowerBlue, Color.Plum, Color.CadetBlue, Color.PeachPuff, Color.LightSalmon };
		private static Color[] _colorsSeaGreen = new Color[] { Color.SeaGreen, Color.MediumAquamarine, Color.SteelBlue, Color.DarkCyan, Color.CadetBlue, Color.MediumSeaGreen, Color.MediumTurquoise, Color.LightSteelBlue, Color.DarkSeaGreen, Color.SkyBlue };
		private static Color[] _colorsSemiTransparent = new Color[] { Color.FromArgb(150, 0xff, 0, 0), Color.FromArgb(150, 0, 0xff, 0), Color.FromArgb(150, 0, 0, 0xff), Color.FromArgb(150, 0xff, 0xff, 0), Color.FromArgb(150, 0, 0xff, 0xff), Color.FromArgb(150, 0xff, 0, 0xff), Color.FromArgb(150, 170, 120, 20), Color.FromArgb(80, 0xff, 0, 0), Color.FromArgb(80, 0, 0xff, 0), Color.FromArgb(80, 0, 0, 0xff), Color.FromArgb(80, 0xff, 0xff, 0), Color.FromArgb(80, 0, 0xff, 0xff), Color.FromArgb(80, 0xff, 0, 0xff), Color.FromArgb(80, 170, 120, 20), Color.FromArgb(150, 100, 120, 50), Color.FromArgb(150, 40, 90, 150) };

		public static Color[] GetPaletteColors(ChartColorPalette palette)
		{
			switch (palette)
			{
				case ChartColorPalette.None:
					throw new ArgumentException(SR.ExceptionPaletteIsEmpty);

				case ChartColorPalette.Bright:
					return _colorsDefault;

				case ChartColorPalette.Grayscale:
					return _colorsGrayScale;

				case ChartColorPalette.Excel:
					return _colorsExcel;

				case ChartColorPalette.Light:
					return _colorsLight;

				case ChartColorPalette.Pastel:
					return _colorsPastel;

				case ChartColorPalette.EarthTones:
					return _colorsEarth;

				case ChartColorPalette.SemiTransparent:
					return _colorsSemiTransparent;

				case ChartColorPalette.Berry:
					return _colorsBerry;

				case ChartColorPalette.Chocolate:
					return _colorsChocolate;

				case ChartColorPalette.Fire:
					return _colorsFire;

				case ChartColorPalette.SeaGreen:
					return _colorsSeaGreen;

				case ChartColorPalette.BrightPastel:
					return _colorsBrightPastel;
			}
			return null;
		}

		private static Color[] InitializeGrayScaleColors()
		{
			Color[] colorArray = new Color[0x10];
			for (int i = 0; i < colorArray.Length; i++)
			{
				int red = 200 - (i * 11);
				colorArray[i] = Color.FromArgb(red, red, red);
			}
			return colorArray;
		}
	}
}

